Recently in writing a JavaScript framework, just put domcontentloaded events packaged, slightly small excitement, the development process encountered in the principles and compatibility issues to make a note, save the forgotten everywhere
This article mainly introduces the JavaScript encapsulation domcontentloaded event instance, domcontentloaded is the unique event of the Ff,opera 9, when all DOM parsing finishes will trigger this event, the need friend can refer to the following
Recently in writing a JavaScript framework, just the Domcontentloaded event encapsulation, slightly small excitement, the development process encountered in the principles and compatibility issues to make a note, the province to forget everywhere
When we write the JS code, The Window.onload event is typically added to select a DOM element to use, such as Getelementbyid,getelementsbytagname, after the DOM finishes loading, but Window.load waits until the DOM is loaded , scripts, CSS, the
This article mainly introduces the Javascript encapsulated DOMContentLoaded Event instance. DOMContentLoaded is a unique Event of FF and Opera9, which will be triggered after all DOM parsing, if you need it, you can refer to the recently written
Recently, I was writing a Javascript framework. I just encapsulated the DOMContentLoaded event and was a little excited. I took a note of the Principles and compatibility issues encountered during the development process, saving me the trouble of
JS is compatible with the DOMContentLoaded events of all browsers, and jsdomcontentloaded
When JavaScript is used to operate dom elements, the code for obtaining dom elements is usually placed inWindow. onload = function () {}Processing function,
Window. Load event
The window. onload event is triggered only when all images, scripts, links, and subboxes in the document are loaded.
Browser compatibility: AllDomcontentloaded event
When the document tree parsing in the page is complete, the
Domcontentloaded The domcontentloaded event is fired when the document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading (the load event can be used to detect a fully-loaded page ).
The onload event of window is commonly used, and the actual effect of this event is: when the page parsing/DOM tree is complete, it is triggered only after downloading all the resources in fragments, scripts, style sheets, and iframe. This is a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.